﻿#region Đào Mạnh Hòa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Collections;
using Common;

namespace BusinessLogic
{
    public static class SelectTongHopCongNoKH 
    {
       public static Entities.KhachHangTraLaiBanLe[] KhachHangTraLaiBanLe()
       {
           Entities.KhachHangTraLaiBanLe temp = new Entities.KhachHangTraLaiBanLe();
           temp.HanhDong = "1";
           temp.MaKho = "";
           temp.MaKhachHangTraLaiBanLe = "";
           Entities.KhachHangTraLaiBanLe[] tem = BusinessLogic.KhachHangTraLaiBanLe.SelectKhachHangTraLaiBanLe(temp);
           if (tem == null)
               tem = new Entities.KhachHangTraLaiBanLe[0];
           return new Entities.KhachHangTraLaiBanLe[0];
       }

       public static Entities.HDBanBuon[] HDBanBuon()
       {
           Entities.HDBanBuon[] tem = BusinessLogic.HDBanBuon.Select();
           if (tem == null)
               tem = new Entities.HDBanBuon[0];
           return tem;
       }

       public static Entities.HDBanLe[] HDBanLe()
       {
           Entities.HDBanLe[] tem = BusinessLogic.HDBanLe.Select();
           if (tem == null)
               tem = new Entities.HDBanLe[0];
           return tem;
       }

       public static Entities.KhachHangTraLaiBanBuon[] KhachHangTraLaiBanBuon()
       {

           Entities.KhachHangTraLaiBanBuon temp = new Entities.KhachHangTraLaiBanBuon();
           temp.HanhDong = "2";
           temp.MaKho = "";
           temp.MaKhachHangTraLaiBanBuon = "";
           Entities.KhachHangTraLaiBanBuon[] tem = BusinessLogic.KhachHangTraLaiBanBuon.SelectKhachHangTraLaiBanBuon(temp);
           if (tem == null)
               tem = new Entities.KhachHangTraLaiBanBuon[0];
           return new Entities.KhachHangTraLaiBanBuon[0];
       }

       public static Entities.KhachHang[] KhachHang()
       {
           Entities.KhachHang t = new Entities.KhachHang();
           t.HanhDong = "1";
           Entities.KhachHang[] tem = BusinessLogic.KhachHang.Select(t);
           if (tem == null)
               tem = new Entities.KhachHang[0];
           return tem;
       }

       public static Entities.PhieuTTCuaKH[] PhieuTTCuaKH()
       {
           Entities.PhieuTTCuaKH[] tem = BusinessLogic.PhieuTTKH.Select();
           if (tem == null)
               tem = new Entities.PhieuTTCuaKH[0];
           return tem;
       }

       public static Entities.ChiTietPhieuTTCuaKH[] ChiTietPhieuTTCuaKH()
       {
           Entities.ChiTietPhieuTTCuaKH[] tem = BusinessLogic.ChiTietPhieuTTKH.Select();
           if (tem == null)
               tem = new Entities.ChiTietPhieuTTCuaKH[0];
           return tem;
       }

       public static Entities.SelectTongHopCongNoKH Select(string hanhDong)
       {
           if (hanhDong == "TongHopKH")
           {
               Entities.SelectTongHopCongNoKH temp = new Entities.SelectTongHopCongNoKH();
               temp.HoaDonBanBuon = HDBanBuon();
               temp.HoaDonBanLe = HDBanLe();
               temp.KhachHangBanBuon = KhachHangTraLaiBanBuon();
               temp.KhachHangBanLe = KhachHangTraLaiBanLe();
               temp.KhachHang = KhachHang();
               temp.PhieuTTCuaKH = PhieuTTCuaKH();
               temp.ChiTietPhieuTTKH = ChiTietPhieuTTCuaKH();
               return temp;
           }
           if (hanhDong == "CongNo")
           {
               Entities.SelectTongHopCongNoKH temp = new Entities.SelectTongHopCongNoKH();
               temp.HoaDonBanBuon = HDBanBuon();
               temp.HoaDonBanLe = HDBanLe();
               temp.KhachHang = KhachHang();
               temp.PhieuTTCuaKH = PhieuTTCuaKH();
               temp.ChiTietPhieuTTKH = ChiTietPhieuTTCuaKH();
               return temp;
           }
           return null;
       }
    }
}
#endregion